<html>
<head><meta charset="utf-8"><title>Seeing types of temporaries in mir? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Seeing.20types.20of.20temporaries.20in.20mir.3F.html">Seeing types of temporaries in mir?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="225668553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Seeing%20types%20of%20temporaries%20in%20mir%3F/near/225668553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Seeing.20types.20of.20temporaries.20in.20mir.3F.html#225668553">(Feb 09 2021 at 10:24)</a>:</h4>
<p>Is there a way to see types of temporaries in mir dumps somehow? For example instead of <code>_1 = ...</code> I'd like to see <code>_1: &lt;type&gt; = ...</code>.</p>



<a name="225669413"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Seeing%20types%20of%20temporaries%20in%20mir%3F/near/225669413" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Seeing.20types.20of.20temporaries.20in.20mir.3F.html#225669413">(Feb 09 2021 at 10:33)</a>:</h4>
<p>The types are defined at the top of the mir. Eg</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="c1">// WARNING: This output format is intended for human consumers only</span>
<span class="c1">// and is subject to change without notice. Knock yourself out.</span>
<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">_0</span>: <span class="p">();</span><span class="w">                      </span><span class="c1">// return place in scope 0 at src/main.rs:1:11: 1:11</span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">_1</span>: <span class="p">();</span><span class="w">                          </span><span class="c1">// in scope 0 at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/macros.rs:95:9: 95:62</span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">_2</span>: <span class="nc">std</span>::<span class="n">fmt</span>::<span class="n">Arguments</span><span class="p">;</span><span class="w">     </span><span class="c1">// in scope 0 at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/macros.rs:95:28: 95:61</span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">_3</span>: <span class="kp">&amp;</span><span class="p">[</span><span class="o">&amp;</span><span class="kt">str</span><span class="p">];</span><span class="w">                 </span><span class="c1">// in scope 0 at src/main.rs:2:14: 2:29</span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">_4</span>: <span class="kp">&amp;</span><span class="p">[</span><span class="o">&amp;</span><span class="kt">str</span><span class="p">;</span><span class="w"> </span><span class="mi">1</span><span class="p">];</span><span class="w">              </span><span class="c1">// in scope 0 at src/main.rs:2:14: 2:29</span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">_5</span>: <span class="kp">&amp;</span><span class="p">[</span><span class="o">&amp;</span><span class="kt">str</span><span class="p">;</span><span class="w"> </span><span class="mi">1</span><span class="p">];</span><span class="w">                  </span><span class="c1">// in scope 0 at src/main.rs:2:14: 2:29</span>
<span class="w">    </span><span class="c1">// ...</span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="225671147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Seeing%20types%20of%20temporaries%20in%20mir%3F/near/225671147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Seeing.20types.20of.20temporaries.20in.20mir.3F.html#225671147">(Feb 09 2021 at 10:50)</a>:</h4>
<p>Ah, I missed that as the output is large and never bothered to read it from the beginning. Thanks!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>